﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="PersonCenter.aspx.cs" Inherits="PersonCenter" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link href="CSS/layout.css" rel="stylesheet" type="text/css" />
    <link href="CSS/Repeater.css" rel="stylesheet" type="text/css" />
    <script src="JS/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="JS/Jquery.form.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnSubmit").click(function () {
                if ($("[id$='fulFile']").val() == "") {
                    alert("请选择要上传的文件!");
                    return false;
                }
                $("[id$='aspnetForm']").ajaxSubmit({
                    url: "ImageHandler.ashx",
                    type: "post",
                    dataType: "text",
                    beforeSubmit: function () {
                        $("[id$='fulFile']").hide();
                        $("[id$='btnSubmit']").hide();
                    },
                    success: function (msg) {
                        $("[id$='fulFile']").show();
                        $("[id$='btnSubmit']").show();
                        if (msg == "0") {
                            alert("上传失败!");
                        }
                        else {
                            alert("上传成功!");
                            $("#ctl00_ContentPlaceHolder1_rpCustomerInfo_ctl00_saveImage").val(msg);
                        }
                        return false;
                    },
                    error: function (jqXHR, errorMsg, errorThrown) {
                        $("[id$='fulFile']").show();
                        $("[id$='btnSubmit']").show();
                        alert("错误信息:" + errorMsg);
                        return false;
                    }
                });
            });
        });
    </script>
    <style>
        .tableClass table
        {
            border-right: 1px solid #000000;
            border-bottom: 1px solid #000000;
        }
        .tableClass table td
        {
            border-left: 1px solid #000000;
            border-top: 1px solid #000000;
        }
    </style>
    <div id="container">
        <div id="sidebar">
        </div>
        <div id="content" class="tableClass">
            <asp:LinkButton runat="server" ID="btnNew" Text="新建"
                OnClick="btnNew_OnClick"></asp:LinkButton>
            <asp:Repeater ID="rpCustomerInfo" runat="server" OnItemDataBound="rpCustomerInfo_ItemDataBound"
                OnItemCommand="rpCustomerInfo_ItemCommand">
                <HeaderTemplate>
                    <table class="list" cellpadding="0" cellspacing="0">
                        <tr class="listheader">
                            <th>
                                厂房地址
                            </th>
                            <th>
                                厂房面积
                            </th>
                            <th>
                                厂房租金
                            </th>
                            <th>
                                业主电话
                            </th>
                            <th>
                                厂房所属区域
                            </th>
                            <th>
                                厂房发布日期
                            </th>
                            <th>
                                操作
                            </th>
                        </tr>
                        <asp:Panel ID="plNew" runat="server" Visible="false">
                            <tr>
                                <td>
                                    厂房地址:<asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    厂房面积:<asp:TextBox ID="txtProportionSum" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    厂房租金:<asp:TextBox ID="txtRental" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    业主电话:<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    所属区域:<asp:DropDownList ID="ddlAreaIDNew" runat="server">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <input id="fulFile" name="fulFile" type="file" class="ful" />
                                    <input id="btnSubmit" type="button" value="上传图片" />
                                    图片名称:<asp:TextBox ID="saveImage" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:LinkButton runat="server" ID="lbtSave" Style="background: #7cfc00" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                        CommandName="Save" Text="保存"></asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="lbtCancel2" Style="background: #7cfc00" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                        CommandName="SaveCancel" Text="取消"></asp:LinkButton>
                                </td>
                            </tr>
                        </asp:Panel>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Panel ID="PlItem" runat="server">
                        <tr  class="listitem1" onmouseover="this.className='over'" onmouseout="this.className='listitem1'">
                            <td>
                                <a href="Page_House.aspx?id=<%#Eval("ID")%>">
                                    <%#Eval("address")%></a>
                            </td>
                            <td>
                                <asp:Label ID="Label10" runat="server" Text='<%#Eval("proportionSum")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="Label11" runat="server" Text='<%#Eval("rental")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text='<%#Eval("ownerPhone")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="Label12" runat="server" Text='<%#Eval("areaID")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="Label13" runat="server" Text='<%#Eval("releaseDate")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:LinkButton  runat="server" ID="lbtEdit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                    Text="编辑" CommandName="Edit"></asp:LinkButton>
                                <asp:LinkButton  runat="server" ID="lbtDelete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                    Text="删除" CommandName="Delete"></asp:LinkButton>
                            </td>
                        </tr>
                    </asp:Panel>
                    <asp:Panel ID="plEdit" runat="server" Visible="false">
                        <tr>
                            <td>
                                厂房地址:<asp:TextBox ID="txtAddressEdit" runat="server" Text='<%#Eval("address")%>'></asp:TextBox>
                            </td>
                            <td>
                                厂房面积:<asp:TextBox ID="proportionSumEdit" runat="server" Text='<%#Eval("proportionSum")%>'></asp:TextBox>
                            </td>
                            <td>
                                厂房租金:<asp:TextBox ID="rentalEdit" runat="server" Text='<%#Eval("rental")%>'></asp:TextBox>
                            </td>
                            <td>
                                业主电话:<asp:TextBox ID="ownerPhoneEdit" runat="server" Text='<%#Eval("ownerPhone")%>'></asp:TextBox>
                            </td>
                            <td>
                                所属区域:<asp:DropDownList ID="ddlAreaIDEdit" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:LinkButton  runat="server" ID="lbtUpdate" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                    CommandName="Update" Text="更新"></asp:LinkButton>
                                <asp:LinkButton  runat="server" ID="lbtCancel" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID")%>'
                                    CommandName="Cancel" Text="取消"></asp:LinkButton>
                            </td>
                        </tr>
                    </asp:Panel>
                </ItemTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
            <br />
            <div style="background-color: #dedede; width: 984px;">
                <asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
                <asp:HyperLink ID="lnkFrist" runat="server">首页</asp:HyperLink>
                <asp:HyperLink ID="lnkPrev" runat="server">上一页</asp:HyperLink>
                <asp:HyperLink ID="lnkNext" runat="server">下一页</asp:HyperLink>
                <asp:HyperLink ID="lnkEnd" runat="server">尾页</asp:HyperLink>
            </div>
        </div>
    </div>
</asp:Content>
